<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \frontend\models\SignupForm */

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;

$this->title = '用户注册';
$this->params['breadcrumbs'][] = $this->title;

?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?= Html::encode($this->title); ?></title>
    <?= Html::cssFile('@web/css/vipcss')?>
    <?= Html::jsFile('@web/js/jquery.min.js')?>
</head>

<body style="background:#f4f4f4;">
	<div id="Header">
         <img src="images/Logo2.jpg" />
         <div class="Title">欢迎注册</div>
         <div style="clear:both"></div>
    </div>
    
    <div id="Content">
         <img class="bj" src="<?= yii::getAlias('@web');?>/images/Bjpic.jpg" />
         <div class="denglu" style="padding-top:0">
            <form class="registerform" action="<?= yii\helpers\Url::to(['auth/signup']);?>" id="subform" method='post' role="form">
              <input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
              <div class="top">
                  <p>已注册可<a style="color:#ea580b;" href="#">直接登录</a></p>
                  <label>用户名 :</label><input id="user" type="text" name="SignupForm[username]" /><label class="la">*</label>
                  <label>设置密码 :</label><input id="pasw" type="text" name="SignupForm[password]" /><label class="la">*</label>
                  <label>确认密码 :</label><input id="pasw" type="text" name="SignupForm[repassword]" /><label class="la">*</label>
                  <label>企业名称 :</label><input id="pasw" type="text" name="SignupForm[qiyename]" /><label class="la">*</label>
                  <label>姓名 :</label><input id="pasw" type="text"  name="SignupForm[xingming]"/><label class="la">*</label>
                  <label>职务 :</label><input id="pasw" type="text"  name="SignupForm[fuwu]"/><label class="la">*</label>
                  <label>手机 :</label><input id="pasw" type="text"  name="SignupForm[phone]"/><label class="la">*</label>
                  <label>邮箱 :</label><input id="pasw" type="text"  name="SignupForm[email]"/><label class="la">*</label>
                  <span style="display:block;"><label>验证码 :</label><input style="width:110px;"  id="pasw" type="text"  /><input id="btnSendCode" type="button" value="获取手机验证码" onClick="sendMessage()"  /></span>
            </form>      
              </div>
              <div class="bom">
                   <input class="a" type="checkbox" /><label>我已阅读并接受<a href="#" style="color:#ea580b;">《某某条款》</a></label>
                   <input id="sub" class="b" type="submit" value="登陆"  />
                   <p><a href="#">忘记密码？</a><a href="#">免费注册</a></p>
              </div>
         </div>
         <div style="clear:both"></div>
    </div>

<script type="text/javascript">
var InterValObj; //timer变量，控制时间
var count = 30; //间隔函数，1秒执行
var curCount;//当前剩余秒数
var code = ""; //验证码
var codeLength = 6;//验证码长度
function sendMessage() {
curCount = count;
var dealType; //验证方式
var uid=$("#uid").val();//用户uid
if ($("#phone").attr("checked") == true) {
	dealType = "phone";
}
else {
	dealType = "email";
}
//产生验证码
for (var i = 0; i < codeLength; i++) {
	code += parseInt(Math.random() * 9).toString();
}
//设置button效果，开始计时
	$("#btnSendCode").attr("disabled", "true");
	$("#btnSendCode").val( + curCount + "秒再获取");
	InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
//向后台发送处理数据
	$.ajax({
		type: "POST", //用POST方式传输
		dataType: "text", //数据格式:JSON
		url: 'Login.ashx', //目标地址
		data: "dealType=" + dealType +"&uid=" + uid + "&code=" + code,
		error: function (XMLHttpRequest, textStatus, errorThrown) { },
		success: function (msg){ }
	});
}
//timer处理函数
function SetRemainTime() {
	if (curCount == 0) {                
		window.clearInterval(InterValObj);//停止计时器
		$("#btnSendCode").removeAttr("disabled");//启用按钮
		$("#btnSendCode").val("重新发送验证码");
		code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
	}
	else {
		curCount--;
		$("#btnSendCode").val( + curCount + "秒再获取");
	}
}
</script>
 
<script>
$(document).ready(function() {
	$("#sub").click(function(){
		   var User = $("#user").val();
		   var Pasw = $("#pasw").val();
		   
		   if(User==""){
			    alert("请填写正确的账号！");
				return false;
			   }
		   
		   if(Pasw==""){
			    alert("请填写正确的密码！");
				return false;
			   }
		})
    
});
</script>
 
    
   
</body>
</html>